package com.neuedu.config;

import com.neuedu.vo.ResultJson;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class DefaultException {
    @ExceptionHandler
    public ResultJson defaultExceptionHandler (Exception ex) {
        ex.printStackTrace();
        if (ex instanceof NeueduException neueduException) {
            return ResultJson.failed(neueduException.getMessage());
        }
        return ResultJson.failed("系统异常");
    }
}
